function [map,explore,path,nowlocation,barrier]=myAstar(explore,true_neighbor,path,barrier,nowlocation)
    %自己写的A*算法，根据上述函数的提供进行自己A*的计算
    worth = []; worth1 = []; worth2 = []; worth3  = [];    %设置每步的综合评价值
    n=size(explore,1);                                     %获取现在已经探索的路径有多少
    for i=1:size(true_neighbor,1)                          %将此步中获得的探索值写入探索路径矩阵，用来画图
        explore(n+i,:)=true_neighbor(i,:);
    end

    for i=1:size(true_neighbor,1)                          %为当前可选择的路进行排序
        worth(i,:) = [i, true_neighbor(i,3)+true_neighbor(i,4) , true_neighbor(i,4)];
    end
    
    %此处是第二个代码的核心修改
    if size(worth,1)==0
        %将此步骤移除路径矩阵，并将此处认定为障碍物，返回上一步，重新规划；
        barrier(path(size(path,1),:))=0;                         %将死角路径标记为障碍物
        path(size(path,1),:)=[];                                 %将次步骤从路径集合中删去
        n=size(path,1);                                     
        nowlocation(1,1) = path(n,1);                            %退回到上一步路径
        nowlocation(1,2) = path(n,2);
        
    else
        worth1 = sortrows(worth,2);  %此处仍需再排一次。
        worth2(1,:)=worth1(1,:);
        for i=1:size(worth1)-1
            if worth1(i+1,2)~=worth1(i,2)
                break
            else
                worth2(i+1,:)=worth1(i+1,:);
            end
        end
        worth3=sortrows(worth2,3);
                
            
        %更新当前位置坐标
        nowlocation(1,1) = true_neighbor(worth3(1),1);
        nowlocation(1,2) = true_neighbor(worth3(1),2);
        barrier(nowlocation(1,1),nowlocation(1,2))=0.5;          %并将其进行标记，避免返回原来走过的路径

        n=size(path,1);                                          %获取现在已经走过的路径有多少，为后面的撞墙返回提供索引
        path(n+1,:)=[nowlocation(1,1),nowlocation(1,2)];

    end
    map = barrier;
    return
end